#ifndef LIBRARY_T_H
#define LIBRARY_T_H

#include <map>
#include "Borrower_t.h"
#include "Book_t.h"
#include "LibraryException.h"

using namespace std;

class Borrower_t;
class Book_t;

typedef long isbn_t;
typedef long id_t;

class Library_t {

	friend ostream &operator<< (ostream& os, const Library_t & library);

private:
	Library_t(const Library_t & library); // copying a library is unavailable... because it doesn't make any sense...
	Library_t & operator= (const Library_t & library); // assignment of library is unavailable

	map<const isbn_t, Book_t *> books_;
	map<const id_t, Borrower_t *> borrowers_;

	bool isUniqueIsbn(const isbn_t & isbn) const;
	bool isUniqueId(const id_t & id) const;


public:
	~Library_t();
	Library_t(){};

	void addBook(const isbn_t & isbn, const string & name, const string & author, const int & num_of_copies);
	void removeBook(const isbn_t & isbn);
	const Book_t * searchBook(const isbn_t & isbn) const;

	void addBorrower(const id_t & id,const string & name);
	void removeBorrower(const id_t & id);
	const Borrower_t * searchBorrower(const id_t & id) const;

	bool lendBook(const isbn_t & isbn, const id_t & id);
	void returnBook(const isbn_t & isbn, const id_t & id);
};

#endif
